furny.jme.appstate
Class SimpleAppState

java.lang.Object
  extended by com.jme3.app.state.AbstractAppState
      extended by furny.jme.appstate.RootNodeState
          extended by furny.jme.appstate.SimpleAppState
All Implemented Interfaces:
com.jme3.app.state.AppState
Direct Known Subclasses:
ModelViewerState

public abstract class SimpleAppState
extends RootNodeState

Extended AppState that contains all behavior of SimpleApplication.

Since:
10.08.2012
Author:
Stephan Dreyer

Nested Class Summary
private  class SimpleAppState.AppActionListener
          Extended listener for key input.
static class SimpleAppState.VIEWPORT
           
 
Field Summary
private  SimpleAppState.AppActionListener actionListener
           
protected  com.jme3.app.Application app
           
protected  com.jme3.asset.AssetManager assetManager
           
protected  com.jme3.renderer.Camera cam
           
protected  com.jme3.system.JmeContext context
           
protected  SimpleAppState.VIEWPORT createViewPort
           
protected  com.jme3.input.FlyByCamera flyCam
           
protected  com.jme3.font.BitmapText fpsText
           
protected  com.jme3.font.BitmapFont guiFont
           
protected  com.jme3.scene.Node guiNode
           
protected  com.jme3.renderer.ViewPort guiViewPort
           
static java.lang.String INPUT_MAPPING_CAMERA_POS
           
static java.lang.String INPUT_MAPPING_EXIT
           
static java.lang.String INPUT_MAPPING_MEMORY
           
protected  com.jme3.input.InputManager inputManager
           
private  java.lang.Integer overrideHeight
           
private  java.lang.Integer overrideWidth
           
protected  com.jme3.renderer.Renderer renderer
           
protected  com.jme3.renderer.RenderManager renderManager
           
protected  float secondCounter
           
protected  com.jme3.system.AppSettings settings
           
private  boolean showFps
           
protected  boolean showSettings
           
private  boolean showStatistics
           
private  boolean showStatsView
           
protected  com.jme3.app.StatsView statsView
           
protected  com.jme3.renderer.ViewPort viewPort
           
 
Fields inherited from class furny.jme.appstate.RootNodeState
rootNode
 
Fields inherited from class com.jme3.app.state.AbstractAppState
initialized
 
Constructor Summary
SimpleAppState()
           
 
Method Summary
 com.jme3.renderer.Camera getCamera()
           
 com.jme3.input.FlyByCamera getFlyByCamera()
          Retrieves flyCam.
 com.jme3.font.BitmapText getFpsText()
          Getter for the fps text to display information.
 com.jme3.scene.Node getGuiNode()
          Retrieves guiNode.
 com.jme3.renderer.ViewPort getGuiViewPort()
          Getter for the gui viewport.
 com.jme3.renderer.ViewPort getViewPort()
          Getter for the main viewport.
private  void initCamera()
          Creates the camera to use for rendering.
 void initialize(com.jme3.app.state.AppStateManager stateManager, com.jme3.app.Application app)
           
 boolean isShowStatistics()
          Getter for the statistics display.
private  void loadFPSText()
          Attaches FPS statistics to guiNode and displays it on the screen.
private  void loadStatsView()
          Attaches Statistics View to guiNode and displays it on the screen above FPS statistics line.
 void setDisplayFps(boolean show)
          Enables/disables fps display.
 void setDisplayStatView(boolean show)
          Enables/disables stat view (memory, texture buffers, etc).
 void setOverrideSize(int width, int height)
          Overrides the width and height of the AppSettings.
 void setShowStatistics(boolean showStatistics)
          Enables/disables statistics display.
abstract  void simpleInitAppState()
          Simple initialization method.
 void simpleUpdate(float tpf)
          Simple update method.
 void update(float tpf)
           
 
Methods inherited from class furny.jme.appstate.RootNodeState
getRootNode
 
Methods inherited from class com.jme3.app.state.AbstractAppState
cleanup, isEnabled, isInitialized, postRender, render, setEnabled, stateAttached, stateDetached
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INPUT_MAPPING_EXIT

public static final java.lang.String INPUT_MAPPING_EXIT
See Also:
Constant Field Values

INPUT_MAPPING_CAMERA_POS

public static final java.lang.String INPUT_MAPPING_CAMERA_POS
See Also:
Constant Field Values

INPUT_MAPPING_MEMORY

public static final java.lang.String INPUT_MAPPING_MEMORY
See Also:
Constant Field Values

viewPort

protected com.jme3.renderer.ViewPort viewPort

guiViewPort

protected com.jme3.renderer.ViewPort guiViewPort

cam

protected com.jme3.renderer.Camera cam

guiNode

protected com.jme3.scene.Node guiNode

secondCounter

protected float secondCounter

fpsText

protected com.jme3.font.BitmapText fpsText

guiFont

protected com.jme3.font.BitmapFont guiFont

statsView

protected com.jme3.app.StatsView statsView

flyCam

protected com.jme3.input.FlyByCamera flyCam

showSettings

protected boolean showSettings

createViewPort

protected SimpleAppState.VIEWPORT createViewPort

app

protected com.jme3.app.Application app

renderManager

protected com.jme3.renderer.RenderManager renderManager

renderer

protected com.jme3.renderer.Renderer renderer

assetManager

protected com.jme3.asset.AssetManager assetManager

inputManager

protected com.jme3.input.InputManager inputManager

context

protected com.jme3.system.JmeContext context

settings

protected com.jme3.system.AppSettings settings

showStatistics

private boolean showStatistics

showFps

private boolean showFps

showStatsView

private boolean showStatsView

actionListener

private final SimpleAppState.AppActionListener actionListener

overrideWidth

private java.lang.Integer overrideWidth

overrideHeight

private java.lang.Integer overrideHeight
Constructor Detail

SimpleAppState

public SimpleAppState()
Method Detail

setOverrideSize

public void setOverrideSize(int width,
                            int height)
Overrides the width and height of the AppSettings.

Parameters:
width - New with.
height - New height.
Since:
10.08.2012

initialize

public final void initialize(com.jme3.app.state.AppStateManager stateManager,
                             com.jme3.app.Application app)
Specified by:
initialize in interface com.jme3.app.state.AppState
Overrides:
initialize in class com.jme3.app.state.AbstractAppState

initCamera

private void initCamera()
Creates the camera to use for rendering. Default values are perspective projection with 45° field of view, with near and far values 1 and 1000 units respectively.


getCamera

public com.jme3.renderer.Camera getCamera()
Returns:
The camera for the application, or null if was not started yet.

getFlyByCamera

public com.jme3.input.FlyByCamera getFlyByCamera()
Retrieves flyCam.

Returns:
flyCam Camera object

getGuiNode

public com.jme3.scene.Node getGuiNode()
Retrieves guiNode.

Returns:
guiNode Node object

update

public final void update(float tpf)
Specified by:
update in interface com.jme3.app.state.AppState
Overrides:
update in class RootNodeState

loadFPSText

private void loadFPSText()
Attaches FPS statistics to guiNode and displays it on the screen.


loadStatsView

private void loadStatsView()
Attaches Statistics View to guiNode and displays it on the screen above FPS statistics line.


getFpsText

public com.jme3.font.BitmapText getFpsText()
Getter for the fps text to display information.

Returns:
The fps text.
Since:
10.08.2012

setShowStatistics

public void setShowStatistics(boolean showStatistics)
Enables/disables statistics display.

Parameters:
showStatistics - Show statistics if true.
Since:
10.08.2012

isShowStatistics

public boolean isShowStatistics()
Getter for the statistics display.

Returns:
Show statistics or not.
Since:
10.08.2012

setDisplayFps

public void setDisplayFps(boolean show)
Enables/disables fps display.

Parameters:
show - Shows the files per second if true.
Since:
10.08.2012

setDisplayStatView

public void setDisplayStatView(boolean show)
Enables/disables stat view (memory, texture buffers, etc).

Parameters:
show - Shows the stat view if true.
Since:
10.08.2012

getGuiViewPort

public com.jme3.renderer.ViewPort getGuiViewPort()
Getter for the gui viewport.

Returns:
Gui viewport.
Since:
10.08.2012

getViewPort

public com.jme3.renderer.ViewPort getViewPort()
Getter for the main viewport.

Returns:
Main viewport.
Since:
10.08.2012

simpleInitAppState

public abstract void simpleInitAppState()
Simple initialization method. Place init code here.

Since:
10.08.2012

simpleUpdate

public void simpleUpdate(float tpf)
Simple update method. Place update code here.

Parameters:
tpf - Time per frame.
Since:
10.08.2012